import 'package:common/dio/larapress_dio.dart';

export '../dio/larapress_dio.dart';
export '../dio/model.dart';

class LaraPressHttp {
  static LaraPressHttp? _instance;
  late LaraPressDio _dio;

  LaraPressHttp._() {
    // 在构造函数中直接初始化
    _dio = LaraPressDio.instance;
    _dio.init(
      NetworkConfig(
        baseUrl: 'https://new.sohajob.com/larapress-api',
        connectTimeout: Duration(seconds: 30),
        receiveTimeout: Duration(seconds: 30),
        sendTimeout: Duration(seconds: 30),
        defaultHeaders: {
          'Content-Type': 'application/json',
          'Accept': 'application/json',
        },
      ),
    );
  }

  /// 单例模式
  static LaraPressHttp get instance {
    _instance ??= LaraPressHttp._();
    return _instance!;
  }

  /// 获取 Dio 实例（直接使用LaraPressDio的所有方法）
  LaraPressDio get dio => _dio;
}
